﻿namespace Rules
{
    public class RequiredRule : RuleBase<object>
    {
        public RequiredRule(string propertyName)
            : base(propertyName) { }

        public RequiredRule(string propertyName, string description)
            : base(propertyName, description) { }

        protected override bool DoEvaluate(object subject)
        {
            return subject != null && !subject.Equals(string.Empty);
        }

        protected override string GetDefaultDescription()
        {
            return string.Format("{0} is required", PropertyName);
        }
    }
}
